import Vue from 'vue'
import cloudbase from "@cloudbase/js-sdk";
const cloud = cloudbase.init({
  env: "blog-3grmqq8jc5419cca"
});

// console.log(this.cloudbase)
const auth = cloud.auth({ persistence: "local" });
if (auth.currentUser) {
  const user = auth.currentUser;
  console.log('userInfo',user)
} else {
  auth
    .anonymousAuthProvider()
    .signIn()
    .then(() => {
      console.log("匿名登录成功");
    })
    .catch(err => {
      console.log(err);
    });
}

Vue.prototype.$cloud = cloud;
export default cloud
